package fuckTest.regex;

import java.util.regex.Pattern;

public class Demo01 {

    private static final Pattern safeUrlPattern = Pattern.compile("https?://(\\w+)*\\.(mytijian)\\.(cn|com).*");
    private static final Pattern emailPattern = Pattern.compile("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");

    public static void main(String[] args) {
        testEmail();
    }


    private static void testEmail(){
        System.out.println(emailPattern.matcher("sense@163.com").find());
        System.out.println(emailPattern.matcher("sense@qq.com").find());
        System.out.println(emailPattern.matcher("sense@a.com").find());
    }

    private static void testUrl() {
        System.out.println(safeUrlPattern.matcher("daily.mytijian.cn/crm").find());
        System.out.println(safeUrlPattern.matcher("https://mytijian.com").find());
        System.out.println(safeUrlPattern.matcher("http://mytijian.cn").find());
        System.out.println(safeUrlPattern.matcher("https://test-api.mytijian.com/crm").find());
        System.out.println(safeUrlPattern.matcher("http://daily.mytijian.cn/crm").find());
    }
}
